package com.wc.alorithm_luogu.P1089;

import java.util.Scanner;

/**
 * @Author congge
 * @Date 2023/4/20 13:25
 * @description https://www.luogu.com.cn/problem/P1089
 * 津津的储蓄计划
 */
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int curMoney = 0;

        int n = 12;

        int lose = 0;

        int matherMoney = 0;

        int consume;
        for (int i = 1; i <= n; i++) {
            consume = sc.nextInt();
            curMoney = 300 - consume + curMoney;
            if (curMoney < 0) {
                lose = -i;
                break;
            }
            matherMoney += curMoney / 100 * 100;
            curMoney %= 100;
        }

        if (lose != 0) {
            for (int i = 0; i < 12 + lose; i++) {
                sc.nextInt();
            }
            System.out.println(lose);
        } else {
            System.out.println(matherMoney / 10 * 12 + curMoney);
        }
    }
}
